package ru.lukyanets.transmission.client.action;

import ru.lukyanets.torrent.TorrentInfo;
import ru.lukyanets.torrent.TorrentInfoMapper;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author slukyanets
 */
public abstract class AddTorrentAction extends TorrentAction {

    protected void addTorrent(InputStream stream) {
        try {
            TorrentInfo torrentInfo = TorrentInfoMapper.from(stream);
            // TODO open torrent info dialog to select FILES and assign other options
            System.out.println(torrentInfo.getAnnounceURL());
        } catch (IOException e) {
            System.out.println("invalid torrent file");
        }
    }
}
